package com.afdor.rws.event.support.retry;

import com.afdor.rws.annotation.extension.Extension;
import com.afdor.rws.event.Event;
import com.afdor.rws.event.channel.client.consumer.handler.EventRetryStrategy;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import lombok.ToString;

/**
 * 默认重试策略，即重试次数加1，并保存，未做真正的重试处理
 *
 * @author 悭梵
 * @date Created in 2018-08-21 15:30
 */
@ToString
@EqualsAndHashCode
@Extension(value = "default", order = Extension.NORMAL_ORDER - 100, interfaceClass = EventRetryStrategy.class)
public class DefaultEventRetryStrategy implements EventRetryStrategy {
    @Override
    public void retry(@NonNull Event event) {
        event.addRetry();
        event.persistence();
    }
}
